#ifndef OBJECTMANAGER_H
#define OBJECTMANAGER_H

#include <list>
using namespace std;

#include "hDataTypes.h"

struct sORobot
{
	float2 m_fPos;
	float2 m_fVel;
	float m_fGunAngle;
	float3 m_fColor;

	float m_fTime;

	sORobot()
	{
		m_fPos.vX = 0.0f;
		m_fPos.vY = 0.0f;
		m_fVel.vX = 0.0f;
		m_fVel.vY = 0.0f;
		m_fGunAngle = 0.0f;
		m_fTime = 0.0f;
	}
};

struct sOBullet
{
	float2 m_fPos;
	float2 m_fVel;
	int m_nOwner;
	float m_fPower;
};

class ObjectManager
{
	unsigned int m_nIDCounter;

public:

	std::list< sORobot* > m_liRobots;
	std::list< sOBullet* > m_liBullets;

	static ObjectManager* getInstance();

	void Update( float fDT );

	sORobot* GetRobot( unsigned int _handle );
	sOBullet* GetBullet( unsigned int _handle ); 

	unsigned int InsertRobot( float2 _pos, float3 _color );
	unsigned int InsertBullet( int _owner, float2 _pos, float2 _vel, float _power );

	void KillRobot( unsigned int _handle );
	void KillBullet( unsigned int _handle );

	void Clear();

};

#endif